package fei.typhoon.engine.android.sprite;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;

public class FeiRectangle extends FeiGeometry {

	protected Paint paint = null;
	protected int alpha = 0xFF;
	/**	包括颜色的alpha值，如0xFF010203 */
	protected int color = 0xFF000000;
	protected RectF region = null;

	protected FeiRectangle(Context context) {
		super(context);
		paint = new Paint();
		paint.setAntiAlias(true);
		paint.setAlpha(alpha);
		paint.setColor(color);
	}

	public FeiRectangle(Context context, int width, int height) {
		this(context);
		setSize(width, height);
		region = new RectF();
	}

	public void setSize(int width, int height) {
		this.width = width;
		this.height = height;
		reDescription(x, y, width, height);
	}

	public void setLocation(int x, int y) {
		this.x = x;
		this.y = y;
		reDescription(x, y, width, height);
	}

	// 数据区域

	public Paint getPaint() {
		return paint;
	}

	public void setPaint(Paint paint) {
		this.paint = paint;
	}

	public int getAlpha() {
		return alpha;
	}

	public void setAlpha(int alpha) {
		this.alpha = alpha;
		this.paint.setAlpha(alpha);
	}

	public int getColor() {
		return color;
	}

	/**
	 * 包括颜色的alpha值，如0xFF010203
	 * 
	 * @param color
	 */
	public void setColor(int color) {
		this.color = color;
		this.paint.setColor(color);
	}

	protected void reDescription(int x, int y, int width, int height) {
		if (region != null) {
			region.left = x;
			region.top = y;
			region.right = x + width;
			region.bottom = y + height;
		}
	}

	@Override
	protected void drawx(Canvas canvas) {
		
	}

}
